package org.example.smartEducationBackend.service;

import org.example.smartEducationBackend.entity.DTO.CommentDTO;
import org.example.smartEducationBackend.entity.POJO.Comment;
import org.example.smartEducationBackend.mapper.CommentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

@Service
public class CommentService {
    @Autowired
    private CommentMapper commentMapper;


    public boolean save(Comment comment) {
        comment.setData(new Date());
        int insert = commentMapper.insert(comment);
        return insert>0;
    }

    public List<CommentDTO> getByVideoId(Integer id) {


        return commentMapper.selectByVideo_id(id);
    }
}
